home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_200 / 291_01 / jjbshow3.c < prev    next >
Text File  |  1989-06-26  |  9KB  |  178 lines

  1. /***************************************************************************
  2.  *                                                                         *
  3.  *                           JJBSHOW3.C                                    *
  4.  *                                                                         *
  5.  *   Copyright (c) 1988, 1989, JJB. All rights reserved.                   *
  6.  *                                                                         *
  7.  *                                                                         *
  8.  *   This example shows you how to assign functions for initalizing and    *
  9.  *   leaving groups and options.                                           *
  10.  *                                                                         *
  11.  *                  'init(functionname)'                                   *
  12.  *                  'leave(functionname)'                                  *
  13.  *                                                                         *
  14.  *   Just glance and it and move on to example JJBSHOW3.C                  *
  15.  *                                                                         *
  16.  *   Turbo C is a trademark of Borland International, Inc.                 *
  17.  *   Quick C is a trademark of Microsoft Corp.                             *
  18.  *   JJB, 9236 church Rd suite 1082, Dallas, Tx 75231 (214) 341-1635       *
  19.  ***************************************************************************/
  20.  
  21.  
  22. /***************************************************************************
  23.  * For Turbo C programmers only:                                           *
  24.  *   To run this program from DOS:                                         *
  25.  *                                                                         *
  26.  *         Enter 'TC JJBSHOW3'    ( to load this file with Turbo C)        *
  27.  *         Press 'CTRL F9'        ( to compile and begin executing)        *
  28.  *                                                                         *
  29.  ***************************************************************************/
  30.  
  31. /***************************************************************************
  32.  * for Quick C programmers only:                                           *
  33.  *   To run this program, from DOS:                                        *
  34.  *                                                                         *
  35.  *         Enter 'JJBQCS3'    ( to load this file with JJB.QLB)            *
  36.  *         Press 'F5'         ( to compile and begin executing)            *
  37.  *                                                                         *
  38.  *   To make the .exe file JJBSHOW3.EXE, from DOS enter:                   *
  39.  *         QCL  /c  /AM  JJBSHOW3.C                                        *
  40.  *         LINK  JJBSHOW3.OBJ + JJBQC.OBJ,,, C:LIB\,                       *
  41.  *                                                                         *
  42.  ***************************************************************************/
  43.  
  44. /***************************************************************************
  45.  *                                                                         *
  46.  * for both TURBO C and QUICK C programmers:                               *
  47.  *                                                                         *
  48.  * Not all options have been assigned functions. The options unassigned    *
  49.  * execute the JJB copyright function.                                     *
  50.  *                                                                         *
  51.  * As JJB executes (runs) a program, the following keys can be pressed:    *
  52.  *                                                                         *
  53.  *    ALT X     to exit.                                                   *
  54.  *    F1        to display a help screen.                                  *
  55.  *    F2-F9     to instantly select another option.                        *
  56.  *    ALT       to select a group of options.                              *
  57.  *    ALT       and a letter to select a specific group.                   *
  58.  *    ESC       means nevermind.                                           *
  59.  *       ->        to select the group to the right.                       *
  60.  *       <-        to select the group to the left.                        *
  61.  *       UPARROW   to highlight the option above.                          *
  62.  *       DOWNARROW to highlight the option below.                          *
  63.  *       RETURN    to select the option highlighted.                       *
  64.  *       A LETTER  to select a specific option.                            *
  65.  *       ALT and a letter to select a different group.                     *
  66.  *       ESC       return exactly where you were in the function           *
  67.  *                      currently being executed.                          *
  68.  *                                                                         *
  69.  * If another option is selected, JJB will execute:                        *
  70.  *                                                                         *
  71.  *         the leave function for the current option.                      *
  72.  *         the leave function for the current group.                       *
  73.  *         the initalization function for the selected group.              *
  74.  *         the initalization function for the selected option.             *
  75.  *         and option function.                                            *
  76.  *                                                                         *
  77.  ***************************************************************************/
  78.  
  79. /* see JJB-READ.DOC for an additional explanation of the functions below.  */
  80. #include <jjbset.h>
  81. main()
  82.   {
  83.   jjb_initalize();        /* initalizes JJB   */
  84.   jjb_setup();            /* setup options & assign functions     */
  85.   jjb_start();            /* start executing the default option   */
  86.  
  87.   }
  88.  
  89.  
  90.  
  91. /***************************************************************************
  92.  *                        SAMPLE HELP FUNCTION                             *
  93.  ***************************************************************************/
  94.  
  95. /* 'vfwc' puts out a window centered on the screen.                    */
  96. vfwc(width,depth) int width,depth; { int row,col;
  97.     row = (25 - depth) / 2;   /* compute row for making the window  */
  98.     col = (80 - width) / 2;   /* compute col for making the window  */
  99.     vfw(row,col,width,depth); /* now make the window                */
  100.     }
  101.  
  102. my_help() {
  103.      vsave_screen();
  104.      set_color(RED ONBLUE);
  105.      vfwc(38,9);                 /*  'vf' a window centered   */
  106.      vfsdo(" ",SAME);
  107.      vfsdo("This example shows you how to",SAME);
  108.      vfsdo("assign functions for initalizing",SAME);
  109.      vfsdo("and exiting groups and options.",SAME);
  110.      vfsdo(" ",SAME);
  111.      vfsdo("Now move on to next show example.",SAME);
  112.      vfsdo(" ",SAME);
  113.      bright();
  114.      vfsc("Press any key "); getch();
  115.      normal();
  116.      vrest_screen();
  117.   }
  118. /* The function below uses some of the functions in the JJB library.*/
  119.  
  120. video_message() {
  121.   vloc(10,20);     /* position the video invisible fast cursor */
  122.   vfsc("This message will appear on the screen.");
  123.   get_ch();
  124.    }
  125.  
  126. init_update() {
  127.   /* you can place any C functions here to initalize the group. */
  128.    }
  129.  
  130. leave_update() {
  131.      /* you can place any C functions here to leave the group. */
  132.  
  133.    }
  134.  
  135. init_vid_msg() {
  136.   /* you can place any functions here to initalize an option.*/
  137.   vloc(4,55); vfs("initalize message, etc.");
  138.    }
  139.  
  140. leave_vid_msg() {
  141.   /* you can place any functions here to leave an option.*/
  142.    }
  143.  
  144.  
  145. /****************************************************************************
  146.  *                                                                          *
  147.  *                       jjb_setup()                                        *
  148.  *                                                                          *
  149.  *   jjb_setup() is where you should define how your pull down menus will   *
  150.  *   for each group and op